home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
AMIGA
/
AMICUS
/
AMICUS11.ADF
/
Progs
/
DifSSed.DOC
< prev
next >
Wrap
Text File
|
1986-08-05
|
5KB
|
112 lines
These are the famous "dif" and "ssed" programs which were originally
written for CP/M by Chuck Forsberg. Together they provided a very
convenient way to distribute updates to public domain source programs
that was MUCH more efficient than re-uploading the entire new source
program. As a fringe benefit, they can be used as the basis for a
source librarian which keeps track of all changes to a system.
As the name implies, "dif" produces a "difference" file which lists the
line-by-line differences between any two text files. It's output can also
be used to check the differences between two files in cases where you
are not sure just what changes you last made. An option (-e) will
cause dif to produce a file of editing commands for it's companion
program "ssed". Given the original source file and the command file
produced by dif, ssed can produce the new source file automatically.
A quick example:
Assume that you have a source file named "main.c" that you wish to update.
Being prudent (You ARE prudent, aren't you?), you copy "main.c" to
"main.old" as backup before beginning your update. At some point, you
have completed testing the new version of "main.c" and wish to send the
update to a friend who has a copy of the original "main.c". You run the
following:
dif -e main.old main.c main.dif
This creates "main.dif" which contains ONLY concise commands to ssed
which reflect the changes you made to "main.c". You send this
"difference" file to your friend who runs the following:
ssed main.c main.dif main.new
At the completion of this run, "main.new" will be an exact copy of your
new "main.c" file. Voila!
Dif uses an 8k circular buffer for each of it's input files and thus
performs a somewhat intelligent search for matching lines within this
8k limit. What this means to you is that dif will be unable to handle
cases where a single change spans more than 8k. If, during an update
for instance, you added a new subroutine which was more than 8k in
length, dif will be unable to handle it. In *very* rare case, it is
possible for dif to get out of synch. For instance, if an update
included NEW lines which happened to accidentally EXACTLY match lines
which also exist in the original file, then dif could get out of synch
and begin reporting ALL lines as changed. If dif DOES manage to
complete normally, then the resulting file WILL work when run through
ssed...the out-of-synch condition just might have caused the "diff"
file to be bigger than the original source file!
Dif and ssed utilize a CRC checking algorithm to ensure that one
does not inadvertently update an incorrect antecedant file. For
instance, if you have "main.realold", "main.old" and "main.new"
and run dif on "main.old" and "main.new" producing "main.dif", "main.dif"
will include CRC values of the "main.old" lines. This will guarantee
that you cannot apply "main.dif" to "main.realold" by accident. If
you do, ssed will report "incorrect antecedant" and quit (unless you
tell ssed to "ignore CRC" errors).
As a convenience, both dif and ssed have options which allow the
input file to be in SQueezed format. This simply means that if
you habitually archive source programs in SQueezed format, you don't
have to UNSQueeze before running these utilities.
Command line format and usage for dif:
dif {<newfile} {>outfile} [-deuv] oldfile [newfile] [outfile]
-d display lines that match
-e generate SSED editor script
-u unsqueeze oldfile
-v verbose
If "newfile" is omitted, then dif reads from Standard Input.
If "outfile" is omitted, then dif writes to Standard Output.
Notes: Standard IN and OUT are shown being re-directed in curly
braces in the above example. The curly braces are intended
to show that the re-direction is optional. Redirection
only works, of course, if the respective parameter was
omitted.
If you omit "newfile", then "outfile" MUST be omitted...
parameters are positional!
Command line format and usage for ssed:
ssed {<cmdfile} {>outfile} [-iuv] infile [cmdfile] [outfile]
-i ignore CRC errors
-u unsqueeze infile
-v verbose
If "cmdfile" is omitted, then ssed reads commands from Standard Input.
If "outfile" is omitted, then ssed writes to Standard Output.
Notes: Standard IN and OUT are shown being re-directed in curly
braces in the above example. The curly braces are intended
to show that the re-direction is optional. Redirection
only works, of course, if the respective parameter was
omitted.
If you omit "cmdfile", then "outfile" MUST be omitted...
parameters are positional!
Dif and Ssed were originally written for CP/M by:
Chuck Forsberg
Omen Technology Inc
Rt 1 Box 120v Portland OR 97231
Compuserve: 70715,131
Conversion to the Amiga done by:
Rick Schaeffer
E. 13611 26th Ave.
Spokane, Wa. 99216
Compuserve: 70120,174
Bix: ricks.
Usenet: ihnp4!tektronix!reed!iscuva!ricks